package com.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.utils.PointDeserializer;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.awt.*;
import java.time.LocalDateTime;

/**
 * ClassName: PostLocation
 * Description:
 *
 * @author L_Z_R
 * @version 1.0
 * @create 2025/05/18 20:05
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class PostLocation {
     private Integer id; // id
     private Integer postId; // 帖子id
     @JsonDeserialize(using = PointDeserializer.class)
     private Point location; // 地理位置坐标
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
     private LocalDateTime crateTime; // 创建时间
     private String locationName; // 地理位置名称

     // 判断位置信息是否有效
     public boolean isValid() {
          return location != null &&
                 locationName != null &&
                 crateTime != null;
     }
}
